package com.nari.springboot.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.nari.springboot.entity.User;

public interface UserMapper {
	@Select("SELECT * FROM user WHERE id = #{id}")
	User getUserById(int id);
 
	@Select("SELECT * FROM user")
	public List<User> getUserList();
 
	@Insert("insert into user(id,userName,passWord) values(#{id}, #{userName}, #{passWord})")
	public int add(User user);
 
	@Update("UPDATE user SET Username = #{user.userName} , Password = #{user.passWord} WHERE id = #{id}")
	public int update(@Param("id") Integer id, @Param("user") User user);
 
	@Delete("DELETE from user where id = #{id} ")
	public int delete(Integer id);
}
